//
//  FSWSegmentRootViewController.h
//  HMT-APP
//
//  Created by 伏圣文 on 2017/9/28.
//  Copyright © 2017年 LXC. All rights reserved.
//

#import "BaseViewController.h"
#import "FSWSegmentView.h"
#import "UIView+CCZBadge.h"

NS_ASSUME_NONNULL_BEGIN
@interface FSWSegmentRootViewController : BaseViewController<UIScrollViewDelegate>

/// initial
+ (__nullable instancetype)segmentControllerWithTitles:(NSArray <NSString *>*)titles;
- (__nullable instancetype)initWithFrame:(CGRect)frame titles:(NSArray *)titles;

@property (nonatomic, strong) NSArray <UIViewController *>*viewControllers;
@property (nonatomic, strong, readonly) FSWSegmentView *segmentView;
@property (nonatomic, strong, readonly) UIViewController *currentViewController;
@property (nonatomic, strong, readonly) UIScrollView *containerView;
@property (nonatomic, readonly) NSUInteger index;
@property (nonatomic, getter=isPagingEnabled) BOOL pagingEnabled;
@property (nonatomic, getter=isBounces) BOOL bounces;

/// index
- (void)selectedAtIndex:(void(^)(NSUInteger index, UIButton *button, UIViewController *viewController))indexBlock;
- (void)setSelectedAtIndex:(NSUInteger)index;

/// number badge
- (void)enumerateBadges:(NSArray <NSNumber *>*)badges;
- (void)reduceCurrentBadgeByNumber_1;
- (void)addCurrentBadgeByNumber_1;
- (void)clearCurrentBadge;
- (void)clearAllBadges;

@end

@interface UIViewController (FSWSegment)

@property (nonatomic, strong, readonly, nullable) FSWSegmentRootViewController *segmentController;

- (void)addSegmentController:(FSWSegmentRootViewController *)segment;
- (void)orderNumberData:(NSArray *)data;
@end
NS_ASSUME_NONNULL_END
